public class test2 {
    class MyCircularQueue {
        public int front;
        public int rear;
        public int[] elem;

        public MyCircularQueue(int k) {
            elem=new int[k+1];
        }

        public boolean enQueue(int value) {
            if(isFull()){
                return false;

            }else{
                elem[rear]=value;
                rear=(rear+1)%elem.length ;
                return true;
            }

        }

        public boolean deQueue() {
            if(isEmpty()){
                return false;
            }else{
                front=(front+1)%elem.length;
                return true;
            }
        }

        public int Front() {
            if(isEmpty()){
                return -1;
            }else{
                return elem[front];
            }
        }

        public int Rear() {
            if(isEmpty()){
                return -1;
            }else{
                int k=(rear+elem.length-1)%elem.length;
                return elem[k];
            }

        }

        public boolean isEmpty() {
            return front==rear;

        }

        public boolean isFull() {
            return (rear+1)%elem.length==front;
        }
    }

/**
 * Your MyCircularQueue object will be instantiated and called as such:
 * MyCircularQueue obj = new MyCircularQueue(k);
 * boolean param_1 = obj.enQueue(value);
 * boolean param_2 = obj.deQueue();
 * int param_3 = obj.Front();
 * int param_4 = obj.Rear();
 * boolean param_5 = obj.isEmpty();
 * boolean param_6 = obj.isFull();
 */
}
